<template>
	<view class="stock">
		<view class="stockInfo">
			<text class="name">{{item.name}}-{{item.id}}</text>
			<text class="code">{{item.code}}</text>
		</view>
		<text class="price col">{{item.newPrice}}</text>
		<text class="radio col">{{item.ratio}}</text>
	</view>
</template>

<script>
	export default {
		props: {
			item: {
				type: Object,
				default: {}
			},
			index: {
				type: Number,
				default: 0
			}
		},
		methods: {
			ChangleBoxHigh( callback ) {
				this.getEleInfo('.stock').then( res => {
					if (!res[0]) retuen;
					callback(res)
				})
			},
			getEleInfo( ele ) {
			    return new Promise( ( resolve, reject ) => {
			        const query = wx.createSelectorQuery().in(this);
			        query.select( ele ).boundingClientRect();
			        query.selectViewport().scrollOffset();
			        query.exec( res => {
			            resolve( res );
			        })
			    })
			},
		}
	}
</script>

<style lang="scss" scoped>
	.stock {
		display: flex;
		align-items: center;
		padding: 12rpx 0;
		font-size: 32rpx;
		.stockInfo{
			width: 160rpx;
			display: flex;
			flex-direction: column;
		}
		.col {
			width: 180rpx;
			text-align: right;
		}
	}
</style>
